package fr.teuteuf.runstickmanrun.screen;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.math.Vector3;

import fr.teuteuf.runstickmanrun.RunStickmanRun;

public abstract class AbstractScreen implements InputProcessor, ControllerListener {
	
	protected RunStickmanRun runStickmanRun;
	
	protected BitmapFont defaultFont;
	
	
	public abstract void reinit();
	public abstract void update(float elapsedTime);
	public abstract void render();
	public abstract void dispose();
	
	public void create() {
		defaultFont = new BitmapFont (Gdx.files.internal("fonts/arial-15.fnt"), Gdx.files.internal("fonts/arial-15.png"), false, true);
	}
	
	public void putForeground() {
		if(runStickmanRun.isOnOuya()) {
			Controllers.addListener(this);
		} else {
			Gdx.input.setInputProcessor(this);
		}
	}

	public void putBackground() {
		if(runStickmanRun.isOnOuya()) {
			Controllers.removeListener(this);
		} else {
			Gdx.input.setInputProcessor(null);
		}
	}
	
	@Override
	public boolean keyDown(int keycode) {
		return false;
	}

	@Override
	public boolean keyUp(int keycode) {
		return false;
	}

	@Override
	public boolean keyTyped(char character) {
		return false;
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		return false;
	}

	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		return false;
	}

	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		return false;
	}

	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		return false;
	}

	@Override
	public boolean scrolled(int amount) {
		return false;
	}

	@Override
	public boolean accelerometerMoved(Controller arg0, int arg1, Vector3 arg2) {
		return false;
	}

	@Override
	public boolean axisMoved(Controller arg0, int arg1, float arg2) {
		return false;
	}

	@Override
	public boolean buttonDown(Controller arg0, int arg1) {
		return false;
	}

	@Override
	public boolean buttonUp(Controller arg0, int arg1) {
		return false;
	}

	@Override
	public void connected(Controller arg0) {
	}

	@Override
	public void disconnected(Controller arg0) {
	}

	@Override
	public boolean povMoved(Controller arg0, int arg1, PovDirection arg2) {
		return false;
	}

	@Override
	public boolean xSliderMoved(Controller arg0, int arg1, boolean arg2) {
		return false;
	}

	@Override
	public boolean ySliderMoved(Controller arg0, int arg1, boolean arg2) {
		return false;
	}
}
